import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import LoginPage from '../pages/login.vue'
import regitserPage from '../pages/register.vue'
import userView from '../views/User.vue'
import adminView from '../views/Admin.vue'
import teacherView from '../views/Teacher.vue'
import partenView from '../views/Parent.vue'
import userInfo from '../components/userInfo.vue'
import systemInfo from "../components/systemInfo.vue"
import roleAply from "../components/roleAply.vue"
import classAdd from "../components/addClassPlay.vue"

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'login',
    component: LoginPage
  },
  {
    path: '/register',
    name: 'register',
    component: regitserPage
  },
  {
    path: "/user",
    name: 'user',
    component: userView,
    children: [
      {
        path: "",
        name: "user",
        component: userInfo
      },
      {
        path: "systemInfo",
        component: systemInfo
      },
      {
        path: "roleAply",
        component: roleAply
      },
    ],
  },
  {
    path: "/admin",
    name: 'admin',
    component: adminView,
    children: [
      {
        path: "",
        name: "admin",
        component: userInfo
      },
      {
        path: "systemInfo",
        component: () => import('../components/deleteSystemInfo.vue')
      },
      {
        path: "roleAply",
        component: roleAply
      },
      {
        path: "createSystemInfo",
        component: () => import('../components/createSystemInfo.vue')
      },
      {
        path: "handleClassAply",
        component: () => import('../components/handleClassAply.vue')
      },
      {
        path: "handleRoleAply",
        component: () => import('../components/handleRoleAply.vue')
      },
      {
        path: "handleClassInfo",
        component: () => import('../components/handleClassInfo.vue')
      },
    ],
  },
  {
    path: "/teacher",
    name: "teacher",
    component: teacherView,
    children: [
      {
        path: "",
        name: "teacher",
        component: userInfo
      },
      {
        path: "systemInfo",
        component: systemInfo
      },
      {
        path: "roleAply",
        component: roleAply
      },
      {
        path: "classAdd",
        component: classAdd
      },
      {
        path: "handelClassAdd",
        component: () => import('../components/handelClassAdd.vue')
      },
      {
        path: "classAply",
        component: () => import('../components/classAply.vue')
      },
      {
        path: "createClassInfo",
        component: () => import('../components/createClassInfo.vue')
      },
      {
        path: "deleteClassInfo",
        component: () => import('../components/deleteClassInfo.vue')
      },
    ],
  },
  {
    path: "/parent",
    name: "parent",
    component: partenView,
    children: [
      {
        path: "",
        name: "parent",
        component: userInfo
      },
      {
        path: "systemInfo",
        component: systemInfo
      },
      {
        path: "roleAply",
        component: roleAply
      },
      {
        path: "classInfo",
        component: () => import('../components/classInfo.vue')
      },
      {
        path: "classAdd",
        component: classAdd
      },
      {
        path: "communicate",
        component: () => import('../components/communicate.vue')
      },
    ],
  },


]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
